package com.example.java8demo.predicateDemo;

import java.util.Arrays;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;

/**
 * 判断参数是否符合条件，返回bool
 *
 * @author tianzhuang
 * @version 1.0
 * @date 2022/1/18 12:07
 */
public class PreDemo {
    public static void test1(Integer val) {
        Integer[] integers = {1, 2, 3, 4, 5};
        List<Integer> list = Arrays.asList(integers);
        Predicate<Integer> predicate = o -> o > val;
        List<Integer> collect = list.stream().filter(predicate).collect(Collectors.toList());
        System.err.println(collect);
    }

    public static void main(String[] args) {
        PreDemo.test1(3);
    }
}
